<!--
 * @Descripttion: damage报损报溢新增
 * @version:
 * @Author: cxguo
 * @Date: 2019-08-17 20:26:23
 * @LastEditors: cxguo
 * @LastEditTime: 2019-12-10 14:45:14
 -->
<template>
  <el-form
    ref="form"
    :model="dataObj"
    :rules="rules"
    label-position="right"
    label-width="100px"
    size="mini"
  >
    <el-form-item :label="`单位名称`" prop="name">
      <el-input v-model="dataObj.name" />
    </el-form-item>
    <el-form-item :label="`状态`">
      <el-switch v-model="dataObj.status" active-value="1" inactive-value="0" />
    </el-form-item>
    <el-form-item label="备注">
      <el-input v-model="dataObj.remark" type="textarea" />
    </el-form-item>
  </el-form>
</template>
<script>
import { oftenuse } from '@/libs/mixins'
import clonedeep from 'clonedeep'

export default {
  name: 'SaveUnit',
  mixins: [oftenuse],
  props: {
    data: {
      type: Object,
      default: () => { return null }
    }
  },
  data() {
    return {
      dataObj: {
        status: '1'
      },
      rules: {
        name: [
          { required: true, message: '请输入名称', trigger: 'blur' }
        ]
      }
    }
  },
  created() {
    this.initData()
  },
  methods: {
    initData() {
      const data = clonedeep(this.data)
      if (data) this.dataObj = data
    },
    getData() {
      return clonedeep(this.dataObj)
    }
  }
}
</script>

<style scoped>
</style>
